home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Temp / MiscPickList / MiscStaticPickList.m < prev    next >
Text File  |  1995-04-12  |  1KB  |  43 lines

  1. // Copyright (c) 1995 Don Yacktman.
  2. // Use is governed by the MiscKit license.
  3.  
  4. #import "MiscStaticPickList.h"
  5. #import <sys/param.h>
  6.  
  7. static MiscDictionary *availableLists = nil;
  8.  
  9. @implementation MiscStaticPickList
  10.  
  11. + findPickListNamed:(MiscString *)aName
  12. {
  13.     if (!availableLists) {
  14.         availableLists = [[MiscDictionary alloc] init];
  15.     }
  16.     if ([availableLists isKey:aName]) {
  17.         return [availableLists valueForKey:aName];
  18.     } else {
  19.         MiscStaticPickList *theList = [[self alloc] initForListNamed:aName];
  20.         [availableLists insertKey:aName value:theList];
  21.         return theList;
  22.     }
  23.     return nil;
  24. }
  25.  
  26. - popUp:sender
  27. {
  28.     [self reloadItemList]; // In case anything changed since last time
  29.     // since we could have a mutable version floating around somewhere...
  30.     return [super popUp:sender];
  31. }
  32.  
  33. // These two are turned into no-ops so that we are immutable...
  34. // But the .nib is missing the buttons anyway so this is only for
  35. // completeness.  Note that you can still mutate things by playing
  36. // with the dictionary yourself.  That will confuse the sorted key
  37. // List, but would sort of work...
  38.  
  39. - addItemToList:(MiscString *)anItem value:(MiscString *)aValue { return nil; }
  40. - removeItemFromList:(MiscString *)anItem { return nil; }
  41.  
  42. @end
  43.